---
title: 安装工具链
description: 本章节介绍用户如何安装相应的交叉编译工具链到编译程序所在的Linux系统。
url: "https://www.hiascend.com/document/detail/zh/Atlas%20200I%20A2/260RC1/RC/driverdevelopmentguide/atlasdg_11_0103.html"
---

# 安装工具链

本章节介绍用户如何安装相应的交叉编译工具链到编译程序所在的Linux系统。

环境准备：一台带网络端口且操作系统为x86 Ubuntu 22.04的Linux服务器。

#### 操作步骤

1. 登录Linux服务器。
2. 执行如下命令，切换至root用户。
  su - root

3. 执行如下命令，创建目录，例如“/opt/compiler”。
  mkdir /opt/compiler

4. 使用WinSCP工具或其他工具，将下载软件包获取的交叉编译工具链包“toolchain.tar.gz”上传至“/opt/compiler”目录。详细操作请参见使用WinSCP传输文件。
5. 执行如下命令，进入“/opt/compiler”目录。
  cd /opt/compiler

6. 执行如下命令，解压交叉编译工具链。
  tar -xvf toolchain.tar.gz -C ./

7. 执行如下命令，在“/etc/profile”配置文件中增加交叉编译工具链路径。
  echo "export PATH=/opt/compiler/toolchain/bin:\$PATH: " >> /etc/profile

8. 执行如下命令，使环境变量生效。
  source /etc/profile

9. 执行如下命令，查看交叉编译工具链版本。
  aarch64-target-linux-gnu-gcc -v

  显示有版本信息，则表明安装工具链成功。具体版本号请以实际情况为准。

```
gcc version 7.3.0 (Do-Compiler V100R003C01B001)
```
